﻿using System;
using ArtMath.Resource;
using ArtMath.Core.Data;

namespace ArtMath.Component.Line
{
    /// <summary>
    /// 两点线段
    /// </summary>
    [Serializable]
    public class TwoPointsLineSegment : LineSegmentBase
    {
        public TwoPointsLineSegment(SketchPad pad, string name, bool addToList = true) : base(pad, name, ToolTypeName.ldxd, addToList)
        {
        }
        protected override void OtherBuildingTransactions(PointD xy)
        {
            ShowStatus($"{Resources.Translate("Creating")}{Resources.ColonSeparate}{Name}{Resources.LeftParenthesis}{string.Format(Resources.Translate("Of"), Resources.Translate("EndPoint") + "2", Resources.Translate("Coordinate"))}{Resources.ColonSeparate}{Pad.PxyToMath(SpareCoordinate)}{Resources.CommaSeparate}{Resources.Translate("LSLength")} = {Length}");
        }
        public override void CreateComponents()
        {
            if (Point1 == null)
            {
                CreateComponents($"{Resources.Translate("EndPoint")}1");
            }
            else
            {
                CreateComponents($"{Resources.Translate("EndPoint")}2");
            }
        }
    }
}
